\begin{table}
\centering
\begin{tabular}{|c|c|}
\hline
true class 1& false class 1\\
\hline
250 & 3\\
247 & 0\\
\hline
true class 2 & false class 2 \\
\hline
\end{tabular}
\caption{Confusion matrix of the MoG-Classifier, using three Gaussians.}
\label{tab:conf3}
\end{table}
Comments about the assignments:
\begin{enumerate}
\item 
    The function \texttt{logsumexp} can be easily created, by using the following
    line:

    \begin{lstlisting}
    Sum = Big + log(1 + exp(Small - Big));
    \end{lstlisting}
    
    Where Big is the larger of the two values (calculated by \texttt{max}), and
    Small is the smaller (calculated by \texttt{min}).

    Of course, \texttt{log} en matlab is the same as $ln$ in the real world.

\item 
    When you would want to calculate extra sums, a sum of this sum can be taken,
    meaning that using \texttt{logsumexp(logsumexp(p(a), p(b)), p(c))} would
    calculate $ln[p(a) + p(b) + p(c)]$.
\item 
    The following is the output of matlab, when running \texttt{logsumexp}:
    \begin{lstlisting}
>> logsumexp(-1000, -1001)          

ans =

 -999.6867
    \end{lstlisting}

    This can, of course, be checked by running \texttt{logsumexp(-1000, -1001)} in
    matlab.
\item  
    After converting mog\_E\_step to the log version, \texttt{ex2} would be unable to run,
    so we added an extra agument to \texttt{em\_mog}, which specified if log or
    ordinary probabilities should be used. The code to be able to use log
    probabilities in the E-step can be found in \texttt{mog\_E\_step\_log.m}. Not
    many adjustments had to be made, only:
    \begin{itemize}
        \item Computing the sum of all Q-values should be done using the new
        function \texttt{logsumexp}
        \item The same counts for the Log-Likelyhood values
        \item Calculating the Q-values should be done by subtracting the sum of
        all Q-values from their k-dependent values, in stead of dividing them
        \item The exponent of the sum mentioned in the previous item should be
        returned, in order to return real probabilities, in stead of log
        probabilities.
    \end{itemize}
\end{enumerate}

The new classifier is slightly better than the other one, resulting in the
confusion matrix in table \ref{tab:conf3}, with error rate 0.006.
